package com.esun.cheetah.view.setting.notice;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.esun.cheetah.config.Config;

/**
 * push通知的广播 com.esun.cheetah.view.setting.notice.NotificationReceiver
 * 
 * @author 任付江 create at 2012-4-25 上午11:09:32
 */
public final class NotificationReceiver extends BroadcastReceiver {
	public NotificationReceiver() {
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
		if (Config.ACTION_SHOW_NOTIFICATION.equals(action)) {
			String notificationId = intent
					.getStringExtra(Config.NOTIFICATION_ID);
			String notificationApiKey = intent
					.getStringExtra(Config.NOTIFICATION_API_KEY);
			String notificationTitle = intent
					.getStringExtra(Config.NOTIFICATION_TITLE);
			String notificationMessage = intent
					.getStringExtra(Config.NOTIFICATION_MESSAGE);
			String notificationUri = intent
					.getStringExtra(Config.NOTIFICATION_URI);
			Notifier notifier = new Notifier(context);
			notifier.notify(notificationId, notificationApiKey,
					notificationTitle, notificationMessage, notificationUri);
		}

	}

}
